/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AdministratorMainGui.java
 *
 * Created on 4 Φεβ 2012, 4:21:51 μμ
 */

package gui;

import HelperClasses.Messages.TerminateQuestion;
import entertainmentguide.entity.User;
import javax.swing.JFrame;

/**
 *
 * 
 */
public class AdministratorMainGui extends javax.swing.JFrame {

    // ο τρέχων χρήστης
    static public  User loggedUser = new User();  
    
    /** Creates new form AdministratorMainGui */
    public AdministratorMainGui() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        LogoLabel = new javax.swing.JLabel();
        TitleLabel = new javax.swing.JLabel();
        BackgroundColorPanel = new javax.swing.JPanel();
        AddRestaurantButton = new javax.swing.JButton();
        UpdateRestaurantButton = new javax.swing.JButton();
        DeleteRestaurantButton = new javax.swing.JButton();
        ExitButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Restaurant Guide");
        setMinimumSize(new java.awt.Dimension(800, 800));
        setPreferredSize(new java.awt.Dimension(800, 800));
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });
        getContentPane().setLayout(null);

        LogoLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/thessaloniki-restaurants.jpg"))); // NOI18N
        LogoLabel.setRequestFocusEnabled(false);
        getContentPane().add(LogoLabel);
        LogoLabel.setBounds(0, 0, 400, 120);

        TitleLabel.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        TitleLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        TitleLabel.setText("Συνδεθήκατε ως διαχειριστής !");
        getContentPane().add(TitleLabel);
        TitleLabel.setBounds(330, 280, 310, 30);

        BackgroundColorPanel.setBackground(new java.awt.Color(255, 153, 102));
        BackgroundColorPanel.setMinimumSize(new java.awt.Dimension(180, 500));
        BackgroundColorPanel.setPreferredSize(new java.awt.Dimension(180, 500));
        BackgroundColorPanel.setLayout(null);

        AddRestaurantButton.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        AddRestaurantButton.setText("Εισαγωγή Νέου");
        AddRestaurantButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AddRestaurantButtonActionPerformed(evt);
            }
        });
        BackgroundColorPanel.add(AddRestaurantButton);
        AddRestaurantButton.setBounds(10, 38, 153, 21);

        UpdateRestaurantButton.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        UpdateRestaurantButton.setText("Τροποποίηση");
        UpdateRestaurantButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                UpdateRestaurantButtonActionPerformed(evt);
            }
        });
        BackgroundColorPanel.add(UpdateRestaurantButton);
        UpdateRestaurantButton.setBounds(10, 79, 153, 21);

        DeleteRestaurantButton.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        DeleteRestaurantButton.setText("Διαγραφή");
        DeleteRestaurantButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DeleteRestaurantButtonActionPerformed(evt);
            }
        });
        BackgroundColorPanel.add(DeleteRestaurantButton);
        DeleteRestaurantButton.setBounds(10, 120, 153, 21);

        ExitButton.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        ExitButton.setText("Έξοδος");
        ExitButton.setPreferredSize(new java.awt.Dimension(153, 21));
        ExitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExitButtonActionPerformed(evt);
            }
        });
        BackgroundColorPanel.add(ExitButton);
        ExitButton.setBounds(10, 161, 153, 21);

        getContentPane().add(BackgroundColorPanel);
        BackgroundColorPanel.setBounds(0, 126, 180, 500);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void AddRestaurantButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddRestaurantButtonActionPerformed
        AdminAddRestaurantGui.loggedUser = this.loggedUser;;
        JFrame AddRestaurantForm = new AdminAddRestaurantGui();
        AddRestaurantForm.setBounds(50, 100, 800, 800);
        AddRestaurantForm.setLocationRelativeTo(null); // possition center of screen
        AddRestaurantForm.setResizable(false); // not resizeable
        AddRestaurantForm.setVisible(true); // show AddRestaurantForm 
        dispose();
}//GEN-LAST:event_AddRestaurantButtonActionPerformed

    private void UpdateRestaurantButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateRestaurantButtonActionPerformed
        AdminUpdateRestaurantGui.loggedUser =this.loggedUser;; 
        JFrame UpdateRestaurantForm = new AdminUpdateRestaurantGui();
        UpdateRestaurantForm.setBounds(50, 100, 800, 800);
        UpdateRestaurantForm.setLocationRelativeTo(null); // possition center of screen
        UpdateRestaurantForm.setResizable(false); // not resizeable
        UpdateRestaurantForm.setVisible(true); // show UpdateRestaurantForm
        dispose();
}//GEN-LAST:event_UpdateRestaurantButtonActionPerformed

    private void DeleteRestaurantButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteRestaurantButtonActionPerformed
        AdminDeleteRestaurantGui.loggedUser=this.loggedUser;
        JFrame DeleteRestaurantForm = new AdminDeleteRestaurantGui();
        DeleteRestaurantForm.setBounds(50, 100, 800, 800);
        DeleteRestaurantForm.setLocationRelativeTo(null); // possition center of screen
        DeleteRestaurantForm.setResizable(false); // not resizeable
        DeleteRestaurantForm.setVisible(true); // show DeleteRestaurantForm 
        dispose();
}//GEN-LAST:event_DeleteRestaurantButtonActionPerformed

    private void ExitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitButtonActionPerformed
        // επιστροφή στην οθόνη για login
        EntertainmentGuideGui.loggedUser = this.loggedUser;
        JFrame MainForm = new EntertainmentGuideGui();
        MainForm.setBounds(50, 100, 800, 800);
        MainForm.setLocationRelativeTo(null); // possition center of screen
        MainForm.setResizable(false); // not resizeable
        MainForm.setVisible(true); // show MainForm 
        dispose();
}//GEN-LAST:event_ExitButtonActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        TerminateQuestion.windowClosing(this);
    }//GEN-LAST:event_formWindowClosing

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new AdministratorMainGui().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AddRestaurantButton;
    private javax.swing.JPanel BackgroundColorPanel;
    private javax.swing.JButton DeleteRestaurantButton;
    private javax.swing.JButton ExitButton;
    private javax.swing.JLabel LogoLabel;
    private javax.swing.JLabel TitleLabel;
    private javax.swing.JButton UpdateRestaurantButton;
    // End of variables declaration//GEN-END:variables

}
